/**
 * @description 测试用mobx组件
 */

import { observable, action, runInAction } from "mobx";
import { dictGet } from "@/api/test";

class Login {
  @observable name = ""; //测试
  @observable explain = ""; //字典返回信息

  @action
  loginMess = (name) => {
    runInAction(() => {
      this.name = name;
    });
  };
  @action
  dictionaries = async (word) => {
    try {
      const { type, res } = await dictGet(word);
      console.log("index====mobx", type, res);
      if (type) {
        return res.result;
      } else {
        return "";
      }
    } catch (error) {
      return "";
    }
  };
}
export default Login;
